clear
cd /Users/savitar/Dropbox/Mystuff/PAPERS/ACCEPTED/BS/Data/
* IMPORT DATA
import delimited using SampleDataforUpload.csv
* RESTRICT TO US DATA
keep if (iso_country == "US")
tsset id year

* SETUP ACTIVE AND PASSIVE INVESTORS (DROP IF NO SUCH)
gen active = for_active + dom_active
keep if (active > 0)
gen passive = for_passive + dom_passive
keep if (passive > 0)

* INTERACT WITH SIZE
gen ma_pass=ma*passive
gen ma_act = ma*active

* PI REGRESSION
reghdfe ea1 ma ma_pass ma_act, absorb(id year) vce(cluster id year)
outreg2 using PI1, tex replace
reghdfe ea3 ma ma_pass ma_act, absorb(id year) vce(cluster id year)
outreg2 using PI3, tex replace

* GENERATE ROLLING EA STDEV THEN REGRESS
asrol ea, win(year 1 3) stat(sd) by(id) gen(easd_3)
reghdfe easd_3 ma pass act, absorb(id year) vce(cluster id year)
outreg2 using EVOL, tex replace
